package com.example.conference.controller;


import cn.dev33.satoken.stp.StpUtil;
import cn.dev33.satoken.util.SaResult;
import com.example.conference.domain.User;
import com.example.conference.mapper.CourseNatureMapper;
import com.example.conference.mapper.DeptMajorMapper;
import com.example.conference.mapper.MajorMapper;
import com.example.conference.service.CourseServiceImpl;
import com.example.conference.service.DeptAndRoleServiceImpl;
import com.example.conference.service.UserServiceImpl;
import com.example.conference.utils.Result;
import jakarta.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@CrossOrigin(originPatterns = "*",allowCredentials = "true")
public class ComponentController {
    @Autowired
    DeptAndRoleServiceImpl deptAndRoleService;
    @Autowired
    CourseServiceImpl courseService;
    @Autowired
    CourseNatureMapper courseNatureMapper;
    @Autowired
    MajorMapper majorMapper;
    @Autowired
    DeptMajorMapper deptMajorMapper;

    @RequestMapping("/queryDept")
    public Result queryDept() {return deptAndRoleService.queryDept();}

    @RequestMapping("/queryRole")
    public Result queryRole() {return deptAndRoleService.queryRole();}

    @RequestMapping("/queryCourse")
    public Result queryCourse() {return Result.success().data("items",courseService.queryCourse());}

    @RequestMapping("/queryCourseNature")
    public Result queryCourseNature() {return Result.success().data("items",courseNatureMapper.queryAll());}

    @RequestMapping("/queryMajor")
    public Result queryMajor() {return Result.success().data("items",majorMapper.queryAll());}

    @RequestMapping("/queryDeptMajor")
    public Result queryDeptMajor() {return Result.success().data("items",deptMajorMapper.queryAll());}


}

